/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aplikasirawatinap;

import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;

/**
 *
 * @author Saptaji
 */
public class AdminForm extends javax.swing.JFrame {

    /**
     * Creates new form Admin
     */
    private int ok;
    
    public AdminForm() {
        initComponents();
        setTitle("ADMIN PAGE");
        
        
    }
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        m_logout = new javax.swing.JMenuItem();
        m_manage = new javax.swing.JMenu();
        m_adduser = new javax.swing.JMenuItem();
        m_viewuser = new javax.swing.JMenuItem();
        m_laporan = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setBackground(new java.awt.Color(153, 255, 51));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/image1.jpg"))); // NOI18N

        jMenu1.setText("File");

        m_logout.setText("Log Out");
        m_logout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_logoutActionPerformed(evt);
            }
        });
        jMenu1.add(m_logout);

        jMenuBar1.add(jMenu1);

        m_manage.setText("Manage User");

        m_adduser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/add_user.png"))); // NOI18N
        m_adduser.setText("Add User");
        m_adduser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_adduserActionPerformed(evt);
            }
        });
        m_manage.add(m_adduser);

        m_viewuser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/view_user.png"))); // NOI18N
        m_viewuser.setText("View User");
        m_viewuser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                m_viewuserActionPerformed(evt);
            }
        });
        m_manage.add(m_viewuser);

        jMenuBar1.add(m_manage);

        m_laporan.setText("Laporan");

        jMenuItem1.setText("view laporan");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        m_laporan.add(jMenuItem1);

        jMenuBar1.add(m_laporan);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 750, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void m_adduserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_adduserActionPerformed
        new Add_User().setVisible(true);
        dispose();
    }//GEN-LAST:event_m_adduserActionPerformed

    private void m_viewuserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_viewuserActionPerformed
        // TODO add your handling code here:
        new Tampil_User().setVisible(true);
        dispose();
    }//GEN-LAST:event_m_viewuserActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        Laporan lp =new Laporan();
        lp.setLocationRelativeTo(this);
        lp.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void m_logoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_logoutActionPerformed
        Login l = new Login();
        l.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_m_logoutActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        // TODO add your handling code here:
        ok = JOptionPane.showConfirmDialog(null, "Anda yakin ingin keluar dari aplikasi?", "Konfirmasi", JOptionPane.OK_CANCEL_OPTION);
        if (ok == 0){
            System.exit(0);
        }
    }//GEN-LAST:event_formWindowClosing
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(AdminForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(AdminForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(AdminForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(AdminForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new AdminForm().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem m_adduser;
    private javax.swing.JMenu m_laporan;
    private javax.swing.JMenuItem m_logout;
    private javax.swing.JMenu m_manage;
    private javax.swing.JMenuItem m_viewuser;
    // End of variables declaration//GEN-END:variables
}
